//
// Created by fh on 2021/7/7.
//

#ifndef CDEMO_STRINGMATCH_H
#define CDEMO_STRINGMATCH_H

#include <stdio.h>
#include <stdlib.h>
#include "CustomDefine.h"

/* 字符串匹配 */

/* 求 char* 字符串长度 */
int StringLength(char *string);
/* 暴力匹配算法:BF算法 */
int StringMatchBruteForce(char sourceStr[],int sourceStrLength,char targetStr[],int targetStrLength);
/* BM算法坏字符部分 */
int StringMatchBoyerMooreBadCharacter(char sourceStr[],int sourceStrLength,char targetStr[],int targetStrLength);
/* BM算法好后缀部分 */
int StringMatchBoyerMooreGoodSuffix(char sourceStr[],int sourceStrLength,char targetStr[],int targetStrLength);
/* BM算法整合:坏字符和好后缀结合使用 */
int StringMatchBoyerMoore(char sourceStr[],int sourceStrLength,char targetStr[],int targetStrLength);
/* 王铮老师的代码 */
int wangzhengBM(char sourceStr[],int sourceStrLength,char targetStr[],int targetStrLength);
/* KMP算法 */
int StringMatchKMP(char sourceStr[],int sourceStrLength,char targetStr[],int targetStrLength);

/* 字符串匹配demo */
void StringMatchDemo();

#endif //CDEMO_STRINGMATCH_H
